package com.xingchen.feima.star.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xingchen.feima.common.utils.R;
import com.xingchen.feima.star.entity.NuclearPowerPlant;
import com.xingchen.feima.star.entity.SingleTransportationPlanVersion;
import com.xingchen.feima.star.service.SingleTransportationPlanVersionService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 单次运输计划版本 前端控制器
 * </p>
 *
 * @author yangxc
 * @since 2025-02-23
 */
@RestController
@RequestMapping("/star/singleTransportationPlanVersion")
public class SingleTransportationPlanVersionController {

    @Autowired
    private SingleTransportationPlanVersionService singleTransportationPlanVersionService;

    @ApiOperation(value = "获取单次运输计划版本列表")
    @GetMapping("")
    public R getList(){
        List<SingleTransportationPlanVersion> list = singleTransportationPlanVersionService.list(new QueryWrapper<SingleTransportationPlanVersion>().orderByDesc("id"));
        return R.ok().data("items", list);
    }

    @ApiOperation(value = "根据id删除单次运输计划版本")
    @DeleteMapping("/{id}")
    public R removeById(
            @ApiParam(name = "id", value = "单次运输计划版本id", required = true)
            @PathVariable Long id){

        singleTransportationPlanVersionService.removeById(id);
        return R.ok();
    }

    @ApiOperation("根据id列表批量删除单次运输计划版本")
    @DeleteMapping("/batchRemove")
    public R batchRemove(
            @ApiParam(name = "idList", value = "id列表", required = true)
            @RequestBody List<Long> idList) {

        singleTransportationPlanVersionService.removeByIds(idList);
        return R.ok();
    }
}

